<template>
<!-- 余额流水 -->
<view class="load" v-if="!load">
			<u-loading-icon mode="circle" inactive-color="#fff" text="正在加载..." vertical></u-loading-icon>
	</view>
  <view class="balance wap" v-else>
        <view class="bg mt30">
            <view class="item row" v-for="(item,index) in list" :key="index">
                 <view class="col_18">
                    <view class="f1 c1">{{item.PayType}}</view>
                    <view class="f3 c3 time">{{ getDataTime(item.CreateTime)}}</view>
                </view>
                <view class="col_6 f1  num" :class="{'add':(item.Money > 0),'reduce':(item.Money < 0)}">
                    {{item.Money}}
                </view>
            </view>
        </view>
        <u-empty mode="list" :show="Array.isArray(list) && list.length == 0" iconSize="32" text="暂无数据"></u-empty>
  </view>
</template>

<script>
export default {
    data(){
        return{
            load:false,
            list:[]
        }
    },
    
    methods:{
        setCurrIndex(ind){
            this.currIndex = ind;
        },
        async getList(){
            
            let res = await await this.$api.post('Wallet/MyRecharge');
            this.list = res.data;
            this.load = true;
        },
        async init(){
            this.list = []
            this.getList();
        }
        
    },
    computed:{
            getDataTime(){
                return l => {
                    console.log(l);
                    let d = new Date(l);
                    let timestamp = d.getTime();
                    return this.$u.date(timestamp,'yyyy年mm月dd日 hh时MM分');
                }
            }
    },
    onShow(){
        this.init();
    }
}
</script>

<style lang="scss">
.balance{
    padding-bottom: 80rpx;
}
.bg{
    background: #262626;
    border-radius: 16rpx;
}
.mt30{
    margin-top: 30rpx;
}
.c_sed{
    color: #FDEFBB;
}
.item{
    height: 140rpx;
    align-items: center;
    border-bottom: 1px solid #333;
    .col_18{
        box-sizing: border-box;
        padding-left: 20rpx;
        .time{
            margin-top: 20rpx;
        }
        
    }
    .col_6{
        text-align: right;
        padding-right: 20rpx;
        box-sizing: border-box;
    }
   
}
.add{
    color: #ffaa00;
    &:before{
        content: "+";
    }
}
.reduce{
    color: #d2d2d2;

}
</style>